package com.example.sunnyweather.db;

import java.util.Objects;

public class City {
    private Integer id;
    private String cityName;
    private Integer cityCode;
    //外键
    private Integer provinceId;

    public City() {
    }

    public City(Integer id, String cityName, Integer cityCode, Integer provinceId) {
        this.id = id;
        this.cityName = cityName;
        this.cityCode = cityCode;
        this.provinceId = provinceId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public Integer getCityCode() {
        return cityCode;
    }

    public void setCityCode(Integer cityCode) {
        this.cityCode = cityCode;
    }

    public Integer getProvinceId() {
        return provinceId;
    }

    public void setProvinceId(Integer provinceId) {
        this.provinceId = provinceId;
    }

    @Override
    public String toString() {
        return "City{" +
                "id=" + id +
                ", cityName='" + cityName + '\'' +
                ", cityCode=" + cityCode +
                ", provinceId=" + provinceId +
                '}';
    }
    @Override
    public int hashCode() {
        return Objects.hash(getId(), getCityName(), getCityCode(), getProvinceId());
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof City)) return false;
        City city = (City) o;
        return getId().equals(city.getId()) &&
                getCityName().equals(city.getCityName()) &&
                getCityCode().equals(city.getCityCode()) &&
                getProvinceId().equals(city.getProvinceId());
    }


}
